//引入
import Vue from 'vue'
import VueRouter from 'vue-router'
//引入路由组件
import Home from '@/views/Home'
import News from '../pages/news.vue'
import Content from '../components/MyContent.vue'
import Login from '@/views/Login'
import Enter from '@/views/Login/Enter'
import Password from '@/views/Login/Password'
import Authentication from '@/views/Login/Password/Authentication'
import NewPassword from '@/views/Login/Password/NewPassword'
import PwdSuccess from '@/views/Login/Password/PwdSuccess'
import Register from '@/views/Register'
import CasualUser from '@/views/Register/CasualUser'
import Member from '@/views/Register/Member'

// 使用插件
Vue.use(VueRouter)

//创建router实例对象，去管理一组一组的路由规则
const router = new VueRouter({
   routes:[
      {
         path: '/home', 
         component: Home,
         children:[
          {
            path:'/10',
            component:News
          },
          {
            path:'/11',
            component:Content
          }
        ]
      },
      { path: '/', redirect: '/login' },
      {  
         path:'/login',
         component: Login,
         children: [
            { path: '', redirect: 'enter'},
            { path: 'enter', component: Enter },
            { 
               path: 'password',
               component: Password,
               children: [
                  { path: '', redirect: 'authentication'},
                  { path: 'authentication', component: Authentication },
                  { path: 'newpassword', component: NewPassword },
                  { path: 'pwdsuccess', component: PwdSuccess }
               ]
            }
         ]
      },
      {
         path: '/register',
         component: Register,
         children: [
            { path: '', redirect: 'member'},
            { path: 'casualuser', component: CasualUser },
            { path: 'member', component: Member }
         ]
      }
   ]
})

//暴露router
export default router